package print;

import java.util.ArrayList;

/**
 * Created by abhijeet on 21/7/14.
 */
public class PrintThings {

    public void printOneAsterisk() {
        System.out.println("*");
    }

    public void drawHorizontalLine(int length) {
        for(int i = 0; i < length; i++)
            System.out.print("*");
        System.out.println();
    }

    public void drawVerticalLine(int length) {
        for(int i = 0; i < length; i++)
            System.out.println("*");
    }

    public void drawRightTriangle(int parameter) {
        int i,x;
        i = 0;
        x = 1;

        while(x <= parameter) {
            while (i < x) {
                System.out.print("*");
                i++;
            }
            System.out.println();
            i = 0;
            x++;
        }
    }

    public void drawIsocelesTriangle(int parameter) {
        int i,j,noOfAsterisks;

        noOfAsterisks = 1;
        for(i = 0; i < parameter; i++) {

            for(j = 0; j < parameter - i - 1; j++) {
                System.out.print(" ");
            }

            for(j = 0;j < noOfAsterisks; j++) {
                System.out.print("*");
            }
            noOfAsterisks += 2;
            System.out.println();
        }
    }

    public void drawDiamond(int parameter) {

        int i,j,noOfAsterisks;

        drawIsocelesTriangle(parameter);

        noOfAsterisks = parameter*2 - 3;

        for(i = 0; i < parameter - 1; i++) {

            for(j = 0; j <= i; j++) {
                System.out.print(" ");
            }

            for(j = 0;j < noOfAsterisks; j++) {
                System.out.print("*");
            }
            noOfAsterisks -= 2;
            System.out.println();
        }

    }

    public void drawDiamondWithName(int parameter, String name) {
        int i,j,noOfAsterisks;

        noOfAsterisks = 1;
        for(i = 1; i < parameter; i++) {

            for(j = 0; j < parameter - i; j++) {
                System.out.print(" ");
            }

            for(j = 0;j < noOfAsterisks; j++) {
                System.out.print("*");
            }
            noOfAsterisks += 2;
            System.out.println();
        }
        System.out.println(name);

        noOfAsterisks = parameter*2 - 3;

        for(i = 0; i < parameter - 1; i++) {

            for(j = 0; j <= i; j++) {
                System.out.print(" ");
            }

            for(j = 0;j < noOfAsterisks; j++) {
                System.out.print("*");
            }
            noOfAsterisks -= 2;
            System.out.println();
        }
    }

    public void fizzBuzz() {

        for(int i = 1; i <= 100; i++) {

            if(i%3 == 0 && i%5 == 0)
                System.out.println("FizzBuzz");
            else if(i%3 == 0)
                System.out.println("Fizz");
            else if(i%5 == 0)
                System.out.println("Buzz");
            else
                System.out.println(i);
        }
    }

    public void generate(int number) {
        double sqrt = Math.sqrt(number);
        int num;

        for(int i = 2; i < sqrt; ) {
            if(number % i == 0) {
                System.out.println(i);
                number = number / i;
            }
            else
                i++;
        }

    }

    public static void main(String[] args) {

        PrintThings printThingsObject = new PrintThings();

        printThingsObject.generate(60);
    }
}
